package cn.org.itool.ws.framework.event;


import cn.org.itool.ws.framework.netty.auth.Principal;

import java.util.StringJoiner;

/**
 * WS事件父类
 *
 */
public abstract class WsEvent {

    /**
     * 认证类型
     */
    private final Principal principal;

    /**
     * 构造{@link WsEvent}
     *
     * @param principal 认证类型
     */
    protected WsEvent(Principal principal) {
        this.principal = principal;
    }


    public Principal getPrincipal() {
        return principal;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", WsEvent.class.getSimpleName() + "[", "]")
                .add("principal=" + principal)
                .toString();
    }
}
